<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>后台管理系统</title>
<meta name="author" content="DeathGhost" />
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/resources/css/style.css" />
<script src="<%=request.getContextPath()%>/resources/js/jquery.js"></script>
<script src="<%=request.getContextPath()%>/resources/js/jquery.mCustomScrollbar.concat.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/resources/js/jquery.validate.js"></script>
<script>
	$(function(){
		$("#form").validate({
			rules: {
				rePassword: {
					required: true,
					equalTo: "#newPassword"
				},
			},
			messages: {
				rePassword: {
					equalTo: "<span class='errorTips'>两次密码不一致</span>"
				}
			},
            submitHandler: function (form) {
            	$.ajax({
        			url: "changePass.do",
        			data: $("#form").serialize(),
        			type: "post",
        			success: function(data){
        				if(data.result == true){
        					$.message("success", data.reason);
        					setTimeout(function(){
        						location.reload(true);
        						},1000);
        				}else{
        					$.message("error", data.reason);
        				}
        			}
        		});
            }
		});
	});
</script>
</head>
<body>
	<!--header-->
	<jsp:include page="../common/header.jsp"></jsp:include>

	<section class="rt_wrap content mCustomScrollbar" style="margin: 0 auto;width:700px;">
		<div class="rt_content">
			<p>&nbsp;</p>
			<form id="form" method="post" action="changePass.do">
				<input type="hidden" name="id" value="${admin.id }">
				<table class="table">
					<tr>
						<td>
							管理员: 
						</td>
						<td>
							<strong>${admin.name }</strong>
						</td>
					</tr>
					<tr>
						<td>
							当前密码: 
						</td>
						<td>
							<input type="password"  name="password" size="30" autocomplete="off"/>
						</td>
					</tr>
					<tr>
						<td>
							修改密码: 
						</td>
						<td>
							<input type="password" id="newPassword" name="newPassword" size="30"/>
						</td>
					</tr>
					<tr>
						<td>
							确认密码: 
						</td>
						<td>
							<input type="password" name="rePassword" size="30"/>
						</td>
					</tr>
					<tr>
						<td colspan="2" align="center">
							<input type="submit" name="提交" />
							<input type="reset" name="重置" />
						</td>
					</tr>
				</table>
			</form>
		</div>
	</section>
	<!--结束：以下内容则可删除，仅为素材引用参考-->
</body>
</html>

